﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace PFB_14
{
    class Store
    {
        public Store()
        {
            Products = new List<Product>();
        }

        public List<Product> Products { get; set; }

        public decimal TotalPrice
        {
            get
            {
                decimal total = 0M;

                //for (int i = 0; i < Products.Count; i++)
                //{
                //    total += Products[i].TotalPrice;
                //}

                foreach(Product product in Products)
                {
                    total += product.TotalPrice;
                }

                return total;
            }
        }

        public Product ExpensiveProduct
        {
            get
            {
                Product p = Products[0];

                foreach (Product product in Products)
                {
                    if(product.Price > p.Price)
                    {
                        p = product;
                    }
                }

                return p;
            }
        }

    }
}
